-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(shareReplay): remove redundant variable isComplete
#5458
chore(shareReplay): remove redundant variable isComplete
#5458
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Great! Thank you, @josepot! |
This broke tests at google. I'm not entirely sure why but I don't think the behavior is exactly the same as before. |
Hi @leggechr, I'm very sorry that this PR changed the behavior. I think that I know what's happening, my bad! I'm a bit busy right now, but in a few hours I will get to this. I will add a new test for this use case and I will fix the code. Again, I'm very sorry that I broke this 🙏. I actually thought that this was the expected behavior. |
I could be wrong, but I can only think of one edge-case where this change would alter the behavior, and if that's what happened, then I think that this change actually fixed a bug. I could be wrong, though 😅. Ok, so this is the only thing that I can come up with: With the previous code: If the This is the only change of behavior that I can come up with, and if that's the case, then I think that the new code is fixing a bug? I'm sure that I must be missing something, though. |
Ups! @leggechr I found the issue! Consider the following code:
if the source completes synchronously upon subscription, for instance: from([1, 2, 3, 4, 5]).pipe(
shareReplay({ refCount: true, bufferSize: 1 })
) then the subscription is set first to if (subscription && !subscription.closed && useRefCount && refCount === 0) { I'm afraid that the reason why the tests are not catching this issue is because of #5523 😕 |
…eactiveX#5458)" This reverts commit 9efc3d5.
No worries @josepot! We sync rx at head into Google to test for things like this to catch them before going out to the general public. So I'm glad we could catch it. |
Description:
This PR removes the redundant variable
isComplete
from theshareReplay
operator. This variable became unnecessary after this change.